$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    console.log('detail Ready');
    var mstform = $NG.getCmpApi('p_form_http_m');

    useValuesChange(({ args }) => {
        let user_bdmc = mstform.getItem('u_bdmc').getValue();
        console.log("当前BDMC值:", user_bdmc);
        if (mstform.getItem('u_ywlb').getValue() == 6870000000000112) {
            $NG.updateUI((updater) => {
                const fields = ["u_hylb", 'u_ejhylb', 'u_scfw'];
                fields.forEach((field) => {
                    updater.fieldSetForm.p_form_http_m[field].setProps({
                        hidden: true, //隐藏
                        required: false, //必输
                        /**
                         * qerq
                         * 
                        */
                       //% 3444
                    });
                });
            });
        }
        if (mstform.getItem('u_sccyllb').getValue() == 6870000000000085) {
            $NG.updateUI((updater) => {
                const fields = ["u_hylb", 'u_ejhylb', 'u_scfw'];
                fields.forEach((field) => {
                    updater.fieldSetForm.p_form_http_m[field].setProps({
                        hidden: true, //隐藏
                        required: false, //必输
                        // disabled: true, //只读
                    });
                });
            });
        }
        getTraceProjectInfo()

    }, "p_form_http_m.u_bdmc");
    $NG.updateState((updater) => {
        updater.data.p_form_http_m.setProps({
            u_tpcs: $NG.getCmpApi('p_form_http_d2').getRows().length,
        });
    });
    useUpdateRows(({ args, table }) => {
        console.log($NG.getCmpApi('p_form_http_d2').getRows());
        $NG.updateState((updater) => {
            updater.data.p_form_http_m.setProps({
                u_tpcs: $NG.getCmpApi('p_form_http_d2').getRows().length,
            });
        });

    }, 'p_form_http_d2');

    // %@U2FsdGVkX1+7BeXwL47IeK+ZP/5😀yatOmaL7UH4IaF+3X/muHJSD61KbEXCRd5fc/ZWGRkYgGIqJ/sdn8rOeZg==&&0.0.3

    // 获取跟踪项目信息
    function getTraceProjectInfo() {
        const phid = mstform.getItem("u_bdmc").getValue()
        $NG.execServer("getTraceProjectInfo", { phid }, (res) => {
            if (res.count == 0) return
            const datas = JSON.parse(res.data)[0].extendObjects
            console.log(`跟踪项目信息数据`, datas);
            $NG.updateState((updater) => {
                updater.data.p_form_http_m.setProps({
                    bill_name: datas.u_xmbmc,
                    u_xmbh: datas.bill_no,
                    u_ywlb: {
                        label: datas.ywlb_name,
                        value: datas.ywlb_phid
                    },
                    u_scfw: datas.u_scfw,
                    u_sccyllb: {
                        label: datas.sccyllb_name,
                        value: datas.sccyllb_phid,
                    },
                    u_hylb: {
                        label: datas.hylb_name,
                        value: datas.hylb_phid
                    },
                    u_ejhylb: {
                        label: datas.ejhylb_name,
                        value: datas.ejhylb_phid
                    },
                    u_xmms: {
                        label: datas.xmms_name,
                        value: datas.xmms_phid,
                    },
                    u_yzdw: datas.u_yzdw,
                    u_tpcs: datas.u_tpcs,

                })
            })
        })
    }
}, function () {
    console.log('list Ready');
});